<?php
namespace Home\Controller;
class ApiController extends CommonController{
    public function _initialize(){
        parent::_initialize();
    }

    public function map(){
        $model = $_GET['model'] ? $_GET['model'] : 'house';
        $id = intval($_GET['id']);
        $map = array();
        if($id){
            $info = M($model)->where(array('id'=>$id))->getField('map');
            $mapInfo = explode(',',$info);
            $map['lng'] = $mapInfo[0];
            $map['lat'] = $mapInfo[1];
        }else{
            $map['lng'] = $_GET['lng'];
            $map['lat'] = $_GET['lat'];
        }
        $this->map = $map;
        $this->display($model.'Map');
    }



}